package com.uzai.common.utils;

import com.uzai.common.enums.UzaiCmdKeyEnum;

import java.util.Map;

public class MsgSubCheckUtil {
    public static boolean isSub(Map<String,Boolean> msgSubscribeInfo, String key){
        if (msgSubscribeInfo==null){
            return true;
        }

        Boolean all_subscribe = msgSubscribeInfo.get(UzaiCmdKeyEnum.ALL_SUBSCRIBE.getKey());
        if (all_subscribe!=null && all_subscribe){
            return true;
        }

        Boolean subscribe_model = msgSubscribeInfo.get(key);
        if (subscribe_model==null || subscribe_model){
            return true;
        }

        return false;
    }
}
